//
//  CMMarcoUtility.h
//  CraneMachine
//
//  Created by ice on 2017/10/31.
//  Copyright © 2017年 ICE. All rights reserved.
//

#ifndef CMMarcoUtility_h
#define CMMarcoUtility_h



#pragma mark - 打印
#ifdef DEBUG
#define QYLog(...) NSLog(@"CLASS=%@, LINE=%d -> %@", [self class], __LINE__, [NSString stringWithFormat:__VA_ARGS__])
#else
#define QYLog(...) {}
#endif

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)


///  判断字符串是否为空
#define NULLString(string) ((![string isKindOfClass:[NSString class]])||[string isEqualToString:@""] || (string == nil) || [string isKindOfClass:[NSNull class]]||[[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0)

/** 获取图片资源 */
#define GetImage(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]

#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]] // view圆角
///  弱引用
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
//  keyWindow
#define KeyWindow     [UIApplication sharedApplication].keyWindow
#define QYGSharedAppDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)

#define iPhone6W 375.0
#define iPhone6H 667.0
// x比例 1.293750 在iPhone7的屏幕上
#define ScaleX SCREEN_WIDTH / iPhone6W
// y比例 1.295775
#define ScaleY SCREEN_HEIGHT / iPhone6H
//自动适配屏幕尺寸和设计稿
#define AutoScaleFromDesign(A) (A * ([UIScreen mainScreen].bounds.size.width) / 375.0 )

// 比例宽
#define ScaleW(l) l*ScaleX
// 比例高
#define ScaleH(l) l*ScaleY
// 比例字体
#define ScaleFont(x) [UIFont systemFontOfSize:x*ScaleX]
// 比例字体
#define ScaleBoldFont(x) [UIFont boldSystemFontOfSize:x*ScaleX]

#define iPhoneX (SCREEN_WIDTH == 375.f && SCREEN_HEIGHT == 812.f ? YES : NO)
//#define StatusBar (iPhoneX ? 0.1f : 20.f)
#define SafeBottom (iPhoneX ? 34.f : 0.1f)
#define  STATUSBAR_HEIGHT       (iPhoneX?44.:20.)


#define dispatch_main_async_safe(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_async(dispatch_get_main_queue(), block);\
}

//程序进入后台
#define  AppGoBackgroud       @"AppGoBackgroud"
//程序进入前台
#define  AppGoForegroud       @"AppGoForegroud"

#define homMargin 12.0f
#define  homFlowWith (SCREEN_WIDTH - 3 * homMargin ) / 2
///---------------------------------------------------------
#pragma mark- 微信授权
#define WXAppID                 @"wxc7dc286189d07746"
#define TXbuglyID               @"e4993a56d5"
///---------------------------------------------------------
#pragma mark- DDKeychain
#define USER_ID                 @"USER_ID"
#define SoundType               @"SoundType"
#define BgMusicIsClose          @"BgMusicIsClose"
#define PayType                 @"PayType"
#define WXToken                 @"WXToken"
#define Mall_url                @"mall_url"
#define Socket_url              @"Socket_url"
#define ShowPay                 @"ShowPay"
#define AppName                 @"AppName"
#define DollTest                @"DollTest"

#endif /* CMMarcoUtility_h */
